import request from '@/axios'
import { ResetPassword, UserBasicData, UserDetailData } from '@/api/personal-center/types'

export const getUserDetailApi = (id: number = 0): Promise<IResponse<UserDetailData>> => {
  return request.get({ url: `/user/detail${id ? '/' + id : ''}` })
}

export const updateUserBasicDataApi = (data: UserBasicData): Promise<IResponse> => {
  return request.put({ url: '/user/update', data })
}

export const resetUserPasswordApi = (data: ResetPassword): Promise<IResponse> => {
  return request.post({ url: '/user/reset-password', data })
}
